package comp302.prototype;

import javax.swing.JPanel;
import javax.swing.JButton;

import comp302.prototype.settings.ApplicationSettings;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class ToolsPanel extends JPanel {
	private static final long serialVersionUID = -126669604852564662L;

	public ToolsPanel() {
		super();
		setLayout(null);

		JButton lineButton = new JButton("Line");

		lineButton.addActionListener(new ActionListener() {

			public void actionPerformed(ActionEvent e) {
				MainWindow.getSlideController().getCurrent().getEditHandler().clearState();
				ApplicationSettings
						.setCurrentTool(ApplicationSettings.LINE_TOOL);
				ApplicationSettings.showOptionPanel("linePanel");
			}
		});

		lineButton.setBounds(3, 27, 84, 29);
		add(lineButton);

		JButton btnZigzagButton = new JButton("Zigzag");

		btnZigzagButton.addActionListener(new ActionListener() {

			public void actionPerformed(ActionEvent e) {
				MainWindow.getSlideController().getCurrent().getEditHandler().clearState();
				ApplicationSettings
						.setCurrentTool(ApplicationSettings.ZIGZAG_TOOL);
				ApplicationSettings.showOptionPanel("linePanel");
			}
		});

		btnZigzagButton.setBounds(3, 51, 84, 29);
		add(btnZigzagButton);

		JButton btnSelectMove = new JButton("Select");

		btnSelectMove.addActionListener(new ActionListener() {

			public void actionPerformed(ActionEvent arg0) {
				MainWindow.getSlideController().getCurrent().getEditHandler().clearState();
				ApplicationSettings
						.setCurrentTool(ApplicationSettings.SELECT_TOOL);
				ApplicationSettings.showOptionPanel("selectPanel");
			}
		});

		btnSelectMove.setBounds(3, 3, 84, 29);
		add(btnSelectMove);
	}
}
